﻿<!DOCTYPE html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="Keywords" content="简单的XHTML页面" />
	<meta name="Description" content="这是一个简单的XHTML页面" />
	<title>简单的XHTML页面</title>

</head>
<body>
<script>
    var changefun = function (s1, s2) {
        return 'var _o = ' + s1 + ';' + s1 + ' = ' + s2 + ';' + s2 + ' = _o;';
    };
    var myClass2 = function () {
        var fun1 = function (str) {
            alert('执行函数1，参数：' + str);
        };

        var fun2 = function (str) {
            alert('执行函数2，参数' + str);
        };
        return {
            init: function () {
                eval(changefun('this.fun1', 'this.fun2'));
            },
            fun1: fun1,
            fun2: fun2
        };
    };
    var a = new myClass2();
    a.init();
    a.fun1('1');
    a.fun2('2');
</script>
</body>

</html>